package com.uplooking.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
public class TestController {

	//可以直接访问
	@GetMapping(value="/test1")
	public String test1() {
		return "test1";
	}
	
	//登录后可以访问
	@GetMapping(value="/test2")
	public String test2() {
		return "test2";
	}
	
	//必须是管理员角色才能访问
	@PreAuthorize(value="hasRole('ROLE_ADMIN')")
	@GetMapping(value="/test3")
	public String test3() {
		return "test3";
	}
}
